var o = function (o) {
  return o && o.__esModule ? o : {
    default: o
  };
}(require("../../../../utils/toot.js"));
var bmap = require('../../../../utils/bmap-wx.min.js');
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //星期
    weekdex:0,
    weeklist:[
      { week: "星期一", dates: "03-16" },
      { week: "星期二", dates: "03-17" },
      { week: "星期三", dates: "03-18" },
      { week: "星期三", dates: "03-18" },
      { week: "星期三", dates: "03-18" },
      { week: "星期三", dates: "03-18" },
      { week: "星期三", dates: "03-18" },
      {week:"星期三",dates:"03-18"},
    ],
    long:"",//远程挂号
    inquiry:0,//0 图文  1 视频   2 电话   3 开药
    needFix: false,
    bannerHeight: 0,
    searchlist: ["列表一", "列表二", "列表三", "列表四", "列表五", "列表六"],
    searchCont: "",
    openmore: false,
    tabdex: "",
    popshow: false,
    tablist: [
      {
        types: "综合排序",
        list: [
          { items: "综合排序", checked: false },
          { items: "回答次数", checked: false },
          { items: "星级评分", checked: false },
          { items: "响应时间", checked: false },
          { items: "价格从低到高", checked: false },
          { items: "价格从高到低", checked: false },
        ]
      }, {
        types: "类型",
        list: [
          { items: "图文问诊", checked: false },
          { items: "视频问诊", checked: false },
          { items: "电话问诊", checked: false },
          { items: "开药问诊", checked: false },
        ]
      }, {
        types: "筛选",
        list: [
          { 
            items: "价格区间", 
            section:[
              { items: "10-19", checked: false },
              { items: "20-29", checked: false },
              { items: "30-50", checked: false },
              { items: "50以上", checked: false },
            ]
          },
          {
            items: "医生职称",
            section: [
              { items: "医师", checked: false },
              { items: "主治医师", checked: false },
              { items: "副主任医师", checked: false },
              { items: "主任医师", checked: false },
            ]
          },
        ]
      },
    ],
    shequlist: ["全部社区", "锦东社区", "万科城", "东润国际", "锦绣苑", "龙源小区", "万科紫檀", "锦东社区", "万科城", "东润国际", "锦绣苑", "龙源小区", "万科紫檀", "锦东社区", "万科城", "东润国际", "锦绣苑", "龙源小区", "万科紫檀"],
    shequdex: 0
  },
  //选择日期
  weekitem(e){
    this.setData({
      weekdex:e.currentTarget.dataset.dex
    })
  },
  // 筛选
  typesclick(e){
    let datas = this.data;
    let i = e.currentTarget.dataset.index
    let dex = e.currentTarget.dataset.dex
    datas.tablist[datas.tabdex].list[i].section.map(function(item){
      item.checked = false
    })
    datas.tablist[datas.tabdex].list[i].section[dex].checked = true
    this.setData({
      tablist: datas.tablist
    })
  },
  // 重置
  resultclick(){
    let datas = this.data.tablist;
    for (let i = 0; i < datas[2].list.length;i++){
      let items = datas[2].list[i].section;
      for (let j = 0; j < items.length;j++){
        items[j].checked = false
      }
    }
    this.setData({ tablist: datas})
  },
  // 完成
  submitclick(){
    this.setData({ 
      popshow:false,
      tabdex:""
    })
  },
  // 社区选择
  shequclick(e) {
    this.setData({
      shequdex: e.currentTarget.dataset.dex
    })
  },
  getSearch: function (e) {
    this.setData({
      searchCont: e.detail.value
    })
  },
  // 隐藏弹框
  hidepop() {
    this.setData({
      popshow: false,
      tabdex: ""
    })
  },
  // tab切换
  tabbtn(e) {
    if (e.currentTarget.dataset.dex === this.data.tabdex) {
      this.setData({
        popshow: false,
        tabdex: "",
      })
    } else {
      this.setData({
        popshow: true,
        tabdex: e.currentTarget.dataset.dex,
      })
    }
  },
  // tab选项
  itemchecked(e) {
    let arrs = this.data.tablist, i = this.data.tabdex, dex = e.currentTarget.dataset.dex
    arrs[i].list.map(item => {
      item.checked = false
    })
    if (i==1){
      this.setData({
        inquiry: dex
      })
    }
    arrs[i].types = arrs[i].list[dex].items
    arrs[i].list[dex].checked = true
    this.setData({
      tablist: arrs,
      popshow: false,
      tabdex: ""
    })
  },
  // 展开收起
  openmore() {
    this.setData({
      openmore: !this.data.openmore
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    wx.setNavigationBarTitle({
      title: options.tit,
    })
    if (options.long){
      this.setData({
        long: options.long
      })
    }
  },
  navigator(e) {
    if (this.data.long != 'undefined'){
      wx.navigateTo({
        url: '/hyb_yl/zhuanjiasubpages/pages/orderedtime/orderedtime?inquiry=1'
      })
    }else{
    let inquiry = this.data.inquiry
      wx.navigateTo({
        url: '/hyb_yl/czhuanjiasubpages/pages/zhuanjiazhuye/zhuanjiazhuye?inquiry=' + inquiry
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})